package demo;

class OuterClass{
    public int data1=1;
    public int data2=2;
    public static int data3=3;
    //实例内部类，外部类的里面，方法的外面
    class InnerClass{
        public int data1=100;
        public int data4=4;
        public int data5=5;
        public static int data6=6;

        //内部类的成员方法
        public void test(){
            System.out.println("InnerClass::test()");
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("###########");
            System.out.println(data1);
            System.out.println("外部类.this"+OuterClass.this.data1);
            System.out.println(data2);
            System.out.println(data3);
        }
    }
    public void testA(){
        System.out.println("OuterClass::testA()");
    }
}
public class Test {
    public static void main(String[] args) {
        OuterClass outerClass=new OuterClass();
        //实例内部类的实例化   外部类.内部类 内部类引用=外部类引用.new内部类对象
        OuterClass.InnerClass innerClass=outerClass.new InnerClass();
        innerClass.test();
    }

}
